package com.cyh.ebptpubjar.${table.packageName}.dao;

import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cyh.ebptpubjar.${table.packageName}.entity.${table.entityNameWithEntity};

/**
* ${table.daoName}
* ${table.tableComment}
* @author  ${config.author}
* @version ${config.version}
* 描述：${config.description}
* 时间：${table.genDateTime?string("yyyy-MM-dd HH:mm:ss")}
*/

@Mapper
public interface ${table.daoName}  {

    /**
    * 新增
    * @param entity
    * @return
    */
    int insert(@Param("${table.entityNameLowerName}") ${table.entityNameWithEntity} entity);

    /**
    * 批量新增
    * @param entitys
    * @return
    */
    int insertBatch(@Param("${table.entityNameLowerName}List") List<${table.entityNameWithEntity}> entitys);

<#if table.primaryKeyIsNotEmpty==1>
    /**
    * 修改（根据主键）
    * @param entity
    * @return
    */
    int updateByKey(@Param("${table.entityNameLowerName}") ${table.entityNameWithEntity} entity);
</#if>
<#if table.primaryKeyIsNotEmpty==1>
    /**
    * 删除（根据主键）
    * @param entity
    * @return
    */
    int deleteByKey(@Param("${table.entityNameLowerName}") ${table.entityNameWithEntity} entity);
</#if>
    /**
    * 批量删除（自定义）
    * @param entitys
    * @return
    */
    int deleteBatchByCondition(@Param("${table.entityNameLowerName}List") List<${table.entityNameWithEntity}> entitys);
    /**
    * 删除（自定义）
    * @param entity
    * @return
    */
    int deleteByCondition(@Param("${table.entityNameLowerName}") ${table.entityNameWithEntity} entity);
<#if table.primaryKeyIsNotEmpty==1>
    /**
    * 查询（根据主键）
    * @param entity
    * @return
    */
    ${table.entityNameWithEntity} getByKey(@Param("${table.entityNameLowerName}") ${table.entityNameWithEntity} entity);
</#if>
    /**
    * 分页查询
    * @param page,entity
    * @return
    */
    List<${table.entityNameWithEntity}> getByCondition(IPage<?> page, @Param("${table.entityNameLowerName}") ${table.entityNameWithEntity} entity);

    /**
    * 按照条件查询总数
    * @param entity
    * @return
    */
    int selectCountByCondition(@Param("${table.entityNameLowerName}") ${table.entityNameWithEntity} entity);

    /**
    * 分页批量查询
    * @param page,entitys
    * @return
    */
    List<${table.entityNameWithEntity}> getBatchByCondition(IPage<?> page, @Param("${table.entityNameLowerName}List") List<${table.entityNameWithEntity}> entitys);

}